<?php
ini_set("soap.wsdl_cache_enabled", 0);
require_once("./WebServices.php");



class WebServicos 
{
		
	function __call($method, $args){

		try{
			$objServicos	=	new WebServices();
			$obj= new stdClass;
			$obj->outputXML	=  call_user_func_array(array($objServicos, $method),  array($args[0]->nfseDadosMsg)); 			
			return $obj;		
		}catch(exception $e){
			$array_details = array("Resposta" => "Tente novamente em instantes");
			return new SoapFault("Server", "Falha na chamada ao servico", null, $array_details, "FaultSpecified");
		}
	}
	
}


$Server = new SoapServer(getenv("BASE_URL")."webservice/nfse.wsdl");
$Server->setClass('WebServicos');
$hdr = file_get_contents("php://input");
$Server->handle($hdr);
